// 展开、收起菜单
function spreadOrShrinkMenu() {
    var spreadBtn = document.querySelector('#spreadMenu');
    if (spreadBtn.classList.contains('layui-icon-spread-left')) {
        // 图标变化
        spreadBtn.classList.remove('layui-icon-spread-left');
        spreadBtn.classList.add('layui-icon-shrink-right');

        // 宽度变化
        document.querySelector('.layui-logo').style.width = '200px';
        document.querySelector('.layui-side').style.width = '200px';
        document.querySelector('.layui-nav.layui-nav-tree').style.width = '200px';
        document.querySelector('.layui-body').style.left = '200px';
        document.querySelector('.layui-footer').style.left = '200px';
        document.querySelector('.layui-layout-left').style.left = '200px';

        // 菜单文字显示
        document.querySelector('.easy-logo-title').style.display = '';
        document.querySelectorAll('.easy-menu-title').forEach(e => e.style.display = '');
        document.querySelectorAll('.easy-menu-item a .layui-icon-down').forEach(e => e.style.display = '');
    } else {
        // 图标变化
        spreadBtn.classList.remove('layui-icon-shrink-right');
        spreadBtn.classList.add('layui-icon-spread-left');

        // 宽度变化
        document.querySelector('.layui-logo').style.width = '50px';
        document.querySelector('.layui-side').style.width = '50px';
        document.querySelector('.layui-nav.layui-nav-tree').style.width = '50px';
        document.querySelector('.layui-body').style.left = '50px';
        document.querySelector('.layui-footer').style.left = '50px';
        document.querySelector('.layui-layout-left').style.left = '50px';

        // 菜单文字图标隐藏
        document.querySelector('.easy-logo-title').style.display = 'none';
        document.querySelectorAll('.easy-menu-title').forEach(e => e.style.display = 'none');
        document.querySelectorAll('.easy-menu-item a .layui-icon-down').forEach(e => e.style.display = 'none');
        document.querySelectorAll('.easy-menu-item.layui-nav-itemed').forEach(e => e.classList.remove('layui-nav-itemed'));

    }
}

// 展开菜单
function spreadMenu() {
    var spreadBtn = document.querySelector('#spreadMenu');
    if (spreadBtn.classList.contains('layui-icon-spread-left')) {
        // 图标变化
        spreadBtn.classList.remove('layui-icon-spread-left');
        spreadBtn.classList.add('layui-icon-shrink-right');

        // 宽度变化
        document.querySelector('.layui-logo').style.width = '200px';
        document.querySelector('.layui-side').style.width = '200px';
        document.querySelector('.layui-nav.layui-nav-tree').style.width = '200px';
        document.querySelector('.layui-body').style.left = '200px';
        document.querySelector('.layui-footer').style.left = '200px';
        document.querySelector('.layui-layout-left').style.left = '200px';

        // 菜单文字显示
        document.querySelector('.easy-logo-title').style.display = '';
        document.querySelectorAll('.easy-menu-title').forEach(e => e.style.display = '');
        document.querySelectorAll('.easy-menu-item a .layui-icon-down').forEach(e => e.style.display = '');
    }
}

// 全屏、取消全屏
function fullScreen() {
    var docE = document.documentElement;
    if (!document.fullscreenElement) {
        if (docE.requestFullscreen) {
            docE.requestFullscreen();
        } else if (docE.mozRequestFullScreen) {
            docE.mozRequestFullScreen();
        } else if (docE.webkitRequestFullScreen) {
            docE.webkitRequestFullscreen();
        }

        var fullScreenBtn = document.querySelector('#fullScreen');
        fullScreenBtn.classList.remove('layui-icon-screen-full');
        fullScreenBtn.classList.add('layui-icon-screen-restore');
    } else {
        if (document.exitFullscreen) {
            document.exitFullscreen();
        } else if (document.mozCancelFullScreen) {
            document.mozCancelFullScreen();
        } else if (document.webkitCancelFullScreen) {
            document.webkitCancelFullScreen();
        }

        var fullScreenBtn = document.querySelector('#fullScreen');
        fullScreenBtn.classList.remove('layui-icon-screen-restore');
        fullScreenBtn.classList.add('layui-icon-screen-full');
    }
}